package 力扣刷题.探索初级算法.数组.旋转数组;

import java.util.Scanner;

public class Solution {
    public void rotate(int[] nums, int k) {
        if(k!=0) {
            int temp=nums[nums.length-1];
            for (int i = nums.length-1; i>0; i--) {
                nums[i]=nums[i-1];
            }
            nums[0]=temp;
            rotate(nums, k-1);
        }

    }
    public static void main(String[] args) {
        int len;
        Scanner s=new Scanner(System.in);
        len=s.nextInt();
        int[] nums=new int[len];
        for (int i = 0; i < len; i++) {
            nums[i]=s.nextInt();
        }
        int k=s.nextInt();
        new Solution().rotate(nums,k);
        for (int i = 0; i < len; i++) {
            System.out.println(nums[i]);
        }
    }
}
